import {AppDataSource} from './data.source'
import {Category} from './entity/Category'

AppDataSource.initialize().then(async () => {
    // 树形结构的实体，使用getTreeRepository获取仓库
    const categoryRepository = AppDataSource.getRepository(Category)

    // 保存根节点
    const root = new Category();
    root.name = 'root';
    await categoryRepository.save(root);
}).finally(() => {
    process.exit();
})